'use strict';
// Copyright 2014 Blueant Inc. All Rights Reserved.

/**
 * @fileoverview 任务
 * @author sundbcn@gmail.com (sun debing)
 */

var moment = require('moment');
var modelUtil = require('../util/modelUtil');
var mongoConnector = require('../libs/mongodb/mongoConnector');
/* jshint unused:false */
var dailyTaskSchema = require('../schemas/dailyTaskSchema');
var DailyTask = mongoConnector().model('DailyTask');

/**
 * 根据role_id获取用户
 * @return {[type]} [description]
 */
module.exports.getByRoleId = function (role_id, cb) {
    modelUtil.getByRoleId(DailyTask, role_id, function (err, daily_task_model) {
        if (!!err) {
            console.error(err);
            return cb(err);
        }

        cb(null, daily_task_model);
    });
};

/**
 * 5点刷新
 */
module.exports.onFiveRefresh = function (self, cb) {
    // 刷新剩余次数
    self.refresh();
    cb();
};
